import { Redirect } from "react-router-dom";
import LoginView from "./../views/LoginView"
import HomeView from "./../views/HomeView"
import AboutView from "./../views/AboutView"
import QxView from "./../views/main/QxView"
import YhView from "./../views/main/YhView"

const routes = [
  {
    path: "/",
    exact: true,
    render: () => <Redirect to="/login"></Redirect>
  },
  {
    path: "/login",
    component: LoginView
  },
  {
    path: "/home",
    component: HomeView,
    auth: true,
    routes: [  // 嵌套路由的配置，默认子路由，加一个exact
      { path: "/home", exact: true, render: () => <Redirect to="/home/qx" /> },
      { path: "/home/qx", component: QxView },
      { path: "/home/yh", component: YhView },

    ]
  },
  {
    path: "/about",
    component: AboutView
  },
  {
    path: "*",
    render: (props) => <div>你访问的页面，去火星了。因为成都在隔离管理。</div>
  }
];

export default routes;